package ProjectTeam39.GUITest;

import javax.swing.JFrame;
import java.awt.BorderLayout;
import javax.swing.JLabel;
import javax.swing.SwingConstants;

import ProjectTeam39.Domains.UserList;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.Font;
import javax.swing.DropMode;
import javax.swing.JTextPane;
import java.awt.SystemColor;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JComboBox;

public class PatientFrame extends JFrame {
	UserList ul;
	PatientFrame pframe = this;
	public PatientFrame(final UserList ul) {
		
		this.ul = ul;
		this.setBounds(100, 100, 450, 300);
		
		JPanel panel = new JPanel();
		getContentPane().add(panel, BorderLayout.SOUTH);
		
		
		JSplitPane splitPane = new JSplitPane();
		panel.add(splitPane);
		
		JButton btnLogout = new JButton("Logout");
		btnLogout.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				LoginFrame lframe = new LoginFrame(ul);
				lframe.setBounds(100, 100, 450, 300);
				lframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				pframe.setVisible(false);
				lframe.setVisible(true);
			}
		});
		splitPane.setRightComponent(btnLogout);
		
		JSplitPane splitPane_1 = new JSplitPane();
		splitPane.setLeftComponent(splitPane_1);
		
		JButton btnRequestAppointment = new JButton("Request Appointment");
		splitPane_1.setRightComponent(btnRequestAppointment);
		
		JButton btnViewInvoice = new JButton("View Invoice");
		btnViewInvoice.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				invoiceFrame iframe = new invoiceFrame(ul);
				pframe.setVisible(false);
				iframe.setBounds(100, 100, 450, 300);
				iframe.setVisible(true);
				iframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			}
		});
		splitPane_1.setLeftComponent(btnViewInvoice);
		btnRequestAppointment.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				createApptFrame cframe = new createApptFrame(ul);
				pframe.setVisible(false);
				cframe.setBounds(100, 100, 450, 300);
				cframe.setVisible(true);
				cframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			}
		});
		
		JPanel panel_1 = new JPanel();
		getContentPane().add(panel_1, BorderLayout.CENTER);
		panel_1.setLayout(null);
		
		JLabel lblMedicalInformation = new JLabel("Medical Information");
		lblMedicalInformation.setBounds(10, 43, 94, 14);
		panel_1.add(lblMedicalInformation);
		
		JTextPane txtpnMedInfo = new JTextPane();
		txtpnMedInfo.setBackground(SystemColor.control);
		txtpnMedInfo.setText("blah blah blah test test test test test");
		txtpnMedInfo.setBounds(267, 68, 145, 125);
		panel_1.add(txtpnMedInfo);
		txtpnMedInfo.setEditable(false);
		
		JComboBox recordDates = new JComboBox();
		recordDates.setBounds(46, 68, 94, 20);
		panel_1.add(recordDates);
		
		JPanel panel_2 = new JPanel();
		getContentPane().add(panel_2, BorderLayout.NORTH);
		
		JLabel lblWelcome = new JLabel("Welcome, <Patient Name>");
		lblWelcome.setFont(new Font("Tahoma", Font.PLAIN, 14));
		panel_2.add(lblWelcome);
	}
}
